package com.qfedu.mapper;

import com.qfedu.dto.DeveloperDto;
import com.qfedu.model.Developer;
import com.qfedu.model.Project;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * 概述:
 *
 * @Author: Tbh
 * @Date: 2022/6/27 20:23
 */

public interface DeveloperMapper {

    @Select("select * from developer where did = #{did} and status = 1")
    Developer findByDid(String did);

    @Select("select * from developer where did = #{did} and status = 1")
    DeveloperDto findByDidDto(String did);

    @Select("Select * from developer where status = 1 limit #{currentPage},#{pageSize}")
    List<Developer> findPage(@Param("currentPage") int currentPage, @Param("pageSize") Integer pageSize);

    @Select("select count(*) from developer where status = 1")
    Long count();

    @Insert("insert into developer(did,dname,updatetime) values(#{did},#{dname},#{updatetime})")
    int add(Developer developer);

    @Update("update developer set dname = #{dname},updatetime = #{updatetime} where did = #{did}")
    int updateDev(Developer developer);

    @Update("update developer set status = 0 where did = #{did}")
    int deleteByDid(String did);
}
